﻿using System;
using System.Globalization;
using Avalonia.Data.Converters;

namespace iOSClub.App.Desktop.Converters;

public class DayTimeConverter : IValueConverter
{
    public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
    {
        if (value is DateTime time)
            return time.Year == 0 ? " " : $"{DateTime.Now:yyyy年MM月dd日 HH:mm} , ";
        return value;
    }

    public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
    {
        return value;
    }
}